package xxhui.space.newsclient.Bean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by hui on 2017/7/2.
 */

public class News {
    private int code;
    private String message;
    private String page;
    private String total_count;
    private List<NewsData> data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

    public String getTotal_count() {
        return total_count;
    }

    public void setTotal_count(String total_count) {
        this.total_count = total_count;
    }

    public List<NewsData> getData() {
        return data;
    }

    public void setData(List<NewsData> data) {
        this.data = data;
    }

    public List<HeadlineItem> conversionData(){
        List<HeadlineItem> list = new ArrayList<HeadlineItem>();
        for (NewsData d:data) {
            HeadlineItem item = new HeadlineItem();
            item.setTitle(d.getTitle());
            item.setContentPart(d.getDesc());
            item.setPreviewPicUri(d.getImage());
            item.setUserName("用户名");
            list.add(item);
        }
        return list;
    }

    @Override
    public String toString() {
        return "News{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", page='" + page + '\'' +
                ", total_count='" + total_count + '\'' +
                ", data=" + data +
                '}';
    }
}
